<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>背景图</title>

  <style>
    div {
      width: 300px;
      height: 50vw;
      background-color: pink;
      background-image: url(./bj.gif);   /* 背景图平铺方式-不平铺 */
      background-repeat: no-repeat;
      /* 背景图缩放 */
      background-size: cover;
      background-size: 20%;
      /* 背景图位置 */
      background-position: 20vw center;
    }
  </style>

</head>
<body>
  <div>背景图</div>
</body>
</html>